<!DOCTYPE HTML>
<html lang="en" >
    
    <head>
        
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <title>理解对象 | H5笔记</title>
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <meta name="description" content="">
        <meta name="generator" content="GitBook 2.6.7">
        
        
        <meta name="HandheldFriendly" content="true"/>
        <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
        <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../../gitbook/images/apple-touch-icon-precomposed-152.png">
        <link rel="shortcut icon" href="../../gitbook/images/favicon.ico" type="image/x-icon">
        
    <link rel="stylesheet" href="../../gitbook/style.css">
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-splitter/splitter.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-highlight/website.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-search/search.css">
        
    
        
        <link rel="stylesheet" href="../../gitbook/plugins/gitbook-plugin-fontsettings/website.css">
        
    
    

        
    
    
    <link rel="next" href="../../md/js/事件.html" />
    
    
    <link rel="prev" href="../../md/js/js_date_obj.html" />
    

        
    </head>
    <body>
        
        
    <div class="book"
        data-level="6.2"
        data-chapter-title="理解对象"
        data-filepath="md/js/理解对象.md"
        data-basepath="../.."
        data-revision="Tue Mar 13 2018 17:15:57 GMT+0800 (中国标准时间)"
        data-innerlanguage="">
    

<div class="book-summary">
    <nav role="navigation">
        <ul class="summary">
            
            
            
            

            

            
    
        <li class="chapter " data-level="0" data-path="index.html">
            
                
                    <a href="../../index.html">
                
                        <i class="fa fa-check"></i>
                        
                        Introduction
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1" data-path="md/html/html.html">
            
                
                    <a href="../../md/html/html.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.</b>
                        
                        Html知识
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.1" data-path="md/html/table.html">
            
                
                    <a href="../../md/html/table.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.1.</b>
                        
                        表格
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="md/html/a.html">
            
                
                    <a href="../../md/html/a.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.</b>
                        
                        a标签
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="md/html/anchor.html">
            
                
                    <a href="../../md/html/anchor.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.1.</b>
                        
                        a标签锚点
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="md/html/base.html">
            
                
                    <a href="../../md/html/base.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.2.</b>
                        
                        base标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="md/html/icon.html">
            
                
                    <a href="../../md/html/icon.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.2.3.</b>
                        
                        icon
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="md/html/img.html">
            
                
                    <a href="../../md/html/img.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.</b>
                        
                        图片
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="md/html/picture.html">
            
                
                    <a href="../../md/html/picture.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.1.</b>
                        
                        picture标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="md/html/hotmap.html">
            
                
                    <a href="../../md/html/hotmap.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.2.</b>
                        
                        热区
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="md/html/video.html">
            
                
                    <a href="../../md/html/video.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.3.</b>
                        
                        视频
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="md/html/audio.html">
            
                
                    <a href="../../md/html/audio.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.3.4.</b>
                        
                        音频
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="md/html/tabulation.html">
            
                
                    <a href="../../md/html/tabulation.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.</b>
                        
                        列表
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="md/html/ul.html">
            
                
                    <a href="../../md/html/ul.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.1.</b>
                        
                        无序列表
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4.2" data-path="md/html/dl.html">
            
                
                    <a href="../../md/html/dl.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.2.</b>
                        
                        无序列表2
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.4.3" data-path="md/html/ol.html">
            
                
                    <a href="../../md/html/ol.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.4.3.</b>
                        
                        有序列表
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="md/html/sz.html">
            
                
                    <a href="../../md/html/sz.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.5.</b>
                        
                        实体字符
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="md/html/iframe.html">
            
                
                    <a href="../../md/html/iframe.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.6.</b>
                        
                        iframe标签
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="md/html/form.html">
            
                
                    <a href="../../md/html/form.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.7.</b>
                        
                        form表单
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="md/html/tz.html">
            
                
                    <a href="../../md/html/tz.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>1.8.</b>
                        
                        拓展
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2" data-path="md/css/css.html">
            
                
                    <a href="../../md/css/css.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.</b>
                        
                        CSS
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.1" data-path="md/css/ys.html">
            
                
                    <a href="../../md/css/ys.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.1.</b>
                        
                        元素选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.2" data-path="md/css/id-class.html">
            
                
                    <a href="../../md/css/id-class.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.2.</b>
                        
                        id和class选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.3" data-path="md/css/relationship-selector.html">
            
                
                    <a href="../../md/css/relationship-selector.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.3.</b>
                        
                        关系选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.4" data-path="md/css/w.html">
            
                
                    <a href="../../md/css/w.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.4.</b>
                        
                        伪类选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.5" data-path="md/css/attribute-selectors.html">
            
                
                    <a href="../../md/css/attribute-selectors.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.5.</b>
                        
                        属性选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.6" data-path="md/css/w2.html">
            
                
                    <a href="../../md/css/w2.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.6.</b>
                        
                        伪对象选择器
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.7" data-path="md/css/font.html">
            
                
                    <a href="../../md/css/font.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.7.</b>
                        
                        字体
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.8" data-path="md/css/color.html">
            
                
                    <a href="../../md/css/color.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.8.</b>
                        
                        元素颜色
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9" data-path="md/css/text-shadow.html">
            
                
                    <a href="../../md/css/text-shadow.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.</b>
                        
                        文本阴影
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.9.1" data-path="md/css/textdecoration.html">
            
                
                    <a href="../../md/css/textdecoration.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.9.1.</b>
                        
                        文本的线
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.9.2" data-path="md/cs/vertical-align.html">
            
            <span><b>2.9.2.</b> 文本垂直对齐</span>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.10" data-path="md/css/box.html">
            
                
                    <a href="../../md/css/box.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.</b>
                        
                        盒子
                    </a>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="2.10.1" data-path="md/css/zhu.html">
            
                
                    <a href="../../md/css/zhu.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.1.</b>
                        
                        行内元素和块级元素
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10.2" data-path="md/css/float.html">
            
                
                    <a href="../../md/css/float.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.2.</b>
                        
                        浮动
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.10.3" data-path="md/css/flex.html">
            
                
                    <a href="../../md/css/flex.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.10.3.</b>
                        
                        弹性盒子
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="2.11" data-path="md/css/location.html">
            
                
                    <a href="../../md/css/location.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.11.</b>
                        
                        定位
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="2.12" data-path="md/css/exercise.html">
            
                
                    <a href="../../md/css/exercise.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>2.12.</b>
                        
                        练习
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="3" data-path="md/gitbook/use.html">
            
                
                    <a href="../../md/gitbook/use.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>3.</b>
                        
                        gitbook使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="4" data-path="md/scss/scss.html">
            
                
                    <a href="../../md/scss/scss.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>4.</b>
                        
                        Sass使用
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="5" data-path="md/gulp/gulp.html">
            
                
                    <a href="../../md/gulp/gulp.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>5.</b>
                        
                        Gulp
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6" data-path="md/js.html">
            
            <span><b>6.</b> JS</span>
            
            
            <ul class="articles">
                
    
        <li class="chapter " data-level="6.1" data-path="md/js/js_date_obj.html">
            
                
                    <a href="../../md/js/js_date_obj.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.1.</b>
                        
                        Date对象
                    </a>
            
            
        </li>
    
        <li class="chapter active" data-level="6.2" data-path="md/js/理解对象.html">
            
                
                    <a href="../../md/js/理解对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.2.</b>
                        
                        理解对象
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.3" data-path="md/js/事件.html">
            
                
                    <a href="../../md/js/事件.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.3.</b>
                        
                        事件
                    </a>
            
            
        </li>
    
        <li class="chapter " data-level="6.4" data-path="md/js/XMLHttpRequest对象.html">
            
                
                    <a href="../../md/js/XMLHttpRequest对象.html">
                
                        <i class="fa fa-check"></i>
                        
                            <b>6.4.</b>
                        
                        AJAX
                    </a>
            
            
        </li>
    

            </ul>
            
        </li>
    


            
            <li class="divider"></li>
            <li>
                <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
                    Published with GitBook
                </a>
            </li>
            
        </ul>
    </nav>
</div>

    <div class="book-body">
        <div class="body-inner">
            <div class="book-header" role="navigation">
    <!-- Actions Left -->
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="../../" >H5笔记</a>
    </h1>
</div>

            <div class="page-wrapper" tabindex="-1" role="main">
                <div class="page-inner">
                
                
                    <section class="normal" id="section-">
                    
                        <h3 id="&#x7406;&#x89E3;&#x5BF9;&#x8C61;">&#x7406;&#x89E3;&#x5BF9;&#x8C61;</h3>
<p>1.&#x521B;&#x5EFA;&#x81EA;&#x5B9A;&#x4E49;&#x5BF9;&#x8C61;&#x6700;&#x7B80;&#x5355;&#x7684;&#x65B9;&#x5F0F;&#x5C31;&#x662F;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;Object&#x7684;&#x5B9E;&#x4F8B;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> fenShen = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Object</span>();
    <span class="hljs-comment">//fenShen&#x662F;Object&#x7684;&#x4E00;&#x4E2A;&#x5B9E;&#x4F8B;</span>
    fenShen.name = <span class="hljs-string">&quot;dsda&quot;</span>;
    fenShen.age = <span class="hljs-string">&quot;19&quot;</span>;
    fenShen.say = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
        alert(<span class="hljs-string">&quot;&#x6211;&#x53EB;&quot;</span>+<span class="hljs-keyword">this</span>.name);
    }
</code></pre>
<p>&#x4E5F;&#x53EF;&#x4EE5;&#x901A;&#x8FC7;<strong>&#x5BF9;&#x8C61;&#x5B57;&#x9762;&#x91CF;</strong>&#x6765;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;Object&#x5B9E;&#x4F8B;</p>
<pre><code class="lang-javascript">    <span class="hljs-keyword">var</span> fenShen2 = {
        name:<span class="hljs-string">&quot;sha&quot;</span>,
        age:<span class="hljs-string">&quot;18&quot;</span>,
        say:<span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            alert(<span class="hljs-keyword">this</span>.name);
        }
    }
</code></pre>
<h3 id="&#x521B;&#x5EFA;&#x5BF9;&#x8C61;">&#x521B;&#x5EFA;&#x5BF9;&#x8C61;</h3>
<ol>
<li>&#x5DE5;&#x5382;&#x6A21;&#x5F0F;</li>
</ol>
<pre><code class="lang-javascript">    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">HTC</span>(<span class="hljs-params"></span>)</span>{
        <span class="hljs-keyword">var</span> obj = <span class="hljs-keyword">new</span> <span class="hljs-built_in">Object</span>();
        obj.paizi = <span class="hljs-string">&quot;shuanghui&quot;</span>;
        obj.weidao = <span class="hljs-string">&quot;yumi&quot;</span>;
        obj.weight = <span class="hljs-number">30</span>;
        obj.say = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            alert(<span class="hljs-string">&quot;&#x6211;&#x7684;&#x724C;&#x5B50;&#x662F;&quot;</span>+<span class="hljs-keyword">this</span>.paizi);
        }
        <span class="hljs-keyword">return</span> obj
    }
</code></pre>
<p><em>&#x7F3A;&#x70B9;&#x5C31;&#x662F;&#x65E0;&#x6CD5;&#x8BC6;&#x522B;&#x5BF9;&#x8C61;&#x95EE;&#x9898;</em></p>
<ol>
<li>&#x6784;&#x9020;&#x51FD;&#x6570;</li>
</ol>
<pre><code class="lang-javascript">
    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Person</span>(<span class="hljs-params">name,age</span>)</span>{
        <span class="hljs-keyword">this</span>.name = name,
        <span class="hljs-keyword">this</span>.age = age,
        <span class="hljs-keyword">this</span>.sayName = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
            alert(<span class="hljs-keyword">this</span>.name);
        }
    }
    <span class="hljs-comment">//&#x5B9E;&#x4F8B;&#x5316;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;</span>
    <span class="hljs-comment">//var &#x53D8;&#x91CF; = new &#x6784;&#x9020;&#x51FD;&#x6570;();</span>
    <span class="hljs-keyword">var</span> person1 = <span class="hljs-keyword">new</span> Person(<span class="hljs-string">&quot;Rose&quot;</span>,<span class="hljs-number">18</span>);
    <span class="hljs-keyword">var</span> person2 = <span class="hljs-keyword">new</span> Person(<span class="hljs-string">&quot;Yux&quot;</span>,<span class="hljs-number">18</span>);
    person1.sayName==person2.sayName <span class="hljs-comment">//false</span>
</code></pre>
<p><strong>&#x6784;&#x9020;&#x51FD;&#x6570;&#x7684;&#x95EE;&#x9898;</strong>
<em>&#x6BCF;&#x4E2A;&#x65B9;&#x6CD5;&#x90FD;&#x8981;&#x5728;&#x6BCF;&#x4E2A;&#x5B9E;&#x4F8B;&#x4E0A;&#x91CD;&#x65B0;&#x521B;&#x5EFA;&#x4E00;&#x904D;;&#x6240;&#x4EE5;person1.sayName()&#x8DDF;person2.sayName()&#x4E0D;&#x662F;&#x540C;&#x4E00;&#x4E2A;&#x5BF9;&#x8C61;&#x7684;&#x5B9E;&#x4F8B;</em></p>
<ol>
<li>&#x539F;&#x578B;&#x6A21;&#x5F0F;</li>
</ol>
<p><em>&#x628A;&#x4E00;&#x4E9B;&#x76F8;&#x540C;&#x7684;&#x5C5E;&#x6027;&#x548C;&#x65B9;&#x6CD5;&#x90FD;&#x6302;&#x8F7D;&#x5728;&#x540C;&#x4E00;&#x4E2A;&#x539F;&#x578B;&#x5BF9;&#x8C61;&#x4E0A;</em>&#xFF0C;<strong>&#x6BCF;&#x5F53;&#x6211;&#x4EEC;&#x521B;&#x5EFA;&#x4E00;&#x4E2A;&#x51FD;&#x6570;&#x90FD;&#x4F1A;&#x4E00;&#x4E2A;prototype&#x5C5E;&#x6027;</strong>&#xFF0C;&#x6307;&#x5411;&#x8BE5;&#x51FD;&#x6570;&#x7684;&#x539F;&#x578B;&#x5BF9;&#x8C61;&#xFF0C;&#x8FD9;&#x4E2A;&#x539F;&#x578B;&#x5BF9;&#x8C61;&#x81EA;&#x52A8;&#x83B7;&#x53D6;&#x4E00;&#x4E2A;constructor&#x5C5E;&#x6027;&#xFF0C;&#x6307;&#x5411;&#x5B83;&#x7684;&#x6784;&#x9020;&#x51FD;&#x6570;</p>
<pre><code class="lang-javascript">    <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">Girl</span>(<span class="hljs-params">n</span>)</span>{
        <span class="hljs-comment">//&#x521B;&#x5EFA;&#x7B80;&#x5355;&#x7684;&#x5C5E;&#x6027;</span>
        <span class="hljs-keyword">this</span>.name = n;
        <span class="hljs-keyword">this</span>.ul = <span class="hljs-built_in">document</span>.querySelector();
        <span class="hljs-comment">//&#x628A;&#x65B9;&#x6CD5;&#x6DFB;&#x52A0;&#x5230;&#x539F;&#x578B;&#x5BF9;&#x8C61;(Girl.prototype)&#x4E2D;</span>
    <span class="hljs-comment">//    Girl.prototype.sayName = function(){</span>
    <span class="hljs-comment">//        alert(this.name)</span>
    <span class="hljs-comment">//    }</span>
        <span class="hljs-comment">//&#x521B;&#x5EFA;&#x542F;&#x52A8;&#x5668;&#x51FD;&#x6570;</span>
        <span class="hljs-keyword">this</span>.init()
    }
    <span class="hljs-comment">//&#x5728;&#x539F;&#x578B;&#x5BF9;&#x8C61;&#x91CC;&#x9762;&#x6DFB;&#x52A0;&#x5C5E;&#x6027;&#x6216;&#x65B9;&#x6CD5;</span>
    Girl.prototype.init = <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params"></span>)</span>{
        <span class="hljs-comment">//&#x628A;&#x6307;&#x5411;Girl&#x5BF9;&#x8C61;&#x7684;this&#x7528;&#x53D8;&#x91CF;&#x4FDD;&#x7559;&#x4E0B;&#x6765;,&#x9632;&#x6B62;&#x540E;&#x9762;&#x7684;this&#x6307;&#x5411;&#x88AB;&#x6539;&#x53D8;</span>
        <span class="hljs-keyword">var</span> that = <span class="hljs-keyword">this</span>;
        alert(that.name)
    }
    <span class="hljs-keyword">var</span> jialing = <span class="hljs-keyword">new</span> Girl(<span class="hljs-string">&quot;&#x8D3E;&#x73B2;&quot;</span>);
    <span class="hljs-keyword">var</span> zhiling = <span class="hljs-keyword">new</span> Girl(<span class="hljs-string">&quot;&#x5FD7;&#x73B2;&quot;</span>);
    jialing.sayName == zhiling.sayName <span class="hljs-comment">//true</span>
</code></pre>
<h3 id="&#x7406;&#x89E3;&#x539F;&#x578B;&#x5BF9;&#x8C61;">&#x7406;&#x89E3;&#x539F;&#x578B;&#x5BF9;&#x8C61;</h3>
<p><strong>&#x53EA;&#x8981;&#x6784;&#x5EFA;&#x4E86;&#x4E00;&#x4E2A;&#x51FD;&#x6570;</strong>,&#x8BE5;&#x51FD;&#x6570;&#x90FD;&#x4F1A;&#x83B7;&#x5F97;&#x4E00;&#x4E2A;prototype&#x5C5E;&#x6027;,&#x8FD9;&#x4E2A;&#x5C5E;&#x6027;&#x6307;&#x5411;&#x51FD;&#x6570;&#x7684;&#x539F;&#x578B;&#x5BF9;&#x8C61;,&#x6240;&#x6709;&#x7684;&#x539F;&#x578B;&#x5BF9;&#x8C61;,&#x90FD;&#x4F1A;&#x83B7;&#x5F97;&#x4E00;&#x4E2A;constructor&#x5C5E;&#x6027;,&#x8FD9;&#x4E2A;&#x5C5E;&#x6027;&#x6307;&#x5411;&#x6784;&#x9020;&#x51FD;&#x6570;</p>
<h3 id="&#x7406;&#x89E3;&#x539F;&#x578B;&#x94FE;">&#x7406;&#x89E3;&#x539F;&#x578B;&#x94FE;</h3>
<p>&#x6211;&#x4EEC;&#x5728;&#x8C03;&#x7528;&#x5BF9;&#x8C61;&#x91CC;&#x9762;&#x7684;&#x5C5E;&#x6027;&#x6216;&#x65B9;&#x6CD5;&#x65F6;&#xFF0C;&#x4F1A;&#x9996;&#x5148;&#x8BBF;&#x95EE;&#x672C;&#x8EAB;&#x7684;&#x539F;&#x578B;&#x5BF9;&#x8C61;&#xFF0C;&#x5982;&#x679C;&#x672C;&#x8EAB;&#x4E0D;&#x5177;&#x6709;&#x8FD9;&#x4E2A;&#x5C5E;&#x6027;&#x6216;&#x65B9;&#x6CD5;&#xFF0C;&#x5C31;&#x4F1A;&#x901A;&#x8FC7;<strong>proto</strong>&#x5411;&quot;&#x7238;&#x7238;&quot;&#x7684;&#x539F;&#x578B;&#x5BF9;&#x8C61;&#x4E2D;&#x5BFB;&#x627E;&#xFF0C;&#x5982;&#x679C;&#x90FD;&#x6CA1;&#x6709;&#xFF0C;&#x5219;&#x7EE7;&#x7EED;&#x901A;&#x8FC7;&quot;&#x7238;&#x7238;&quot;&#x7684;<strong>proto</strong>&#x5411;&quot;&#x7237;&#x7237;&quot;&#x7684;&#x539F;&#x578B;&#x5BF9;&#x8C61;&#x627E;&#xFF0C;&#x4E00;&#x76F4;&#x5230;&#x5C3D;&#x5934;Object.prototype,&#x90FD;&#x6CA1;&#x6709;&#x7684;&#x8BDD;&#xFF0C;&#x5219;&#x8FD4;&#x56DE;undefined</p>

                    
                    </section>
                
                
                </div>
            </div>
        </div>

        
        <a href="../../md/js/js_date_obj.html" class="navigation navigation-prev " aria-label="Previous page: Date对象"><i class="fa fa-angle-left"></i></a>
        
        
        <a href="../../md/js/事件.html" class="navigation navigation-next " aria-label="Next page: 事件"><i class="fa fa-angle-right"></i></a>
        
    </div>
</div>

        
<script src="../../gitbook/app.js"></script>

    
    <script src="../../gitbook/plugins/gitbook-plugin-expandable-chapters/expandable-chapters.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-splitter/splitter.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/lunr.min.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-search/search.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-sharing/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-fontsettings/buttons.js"></script>
    

    
    <script src="../../gitbook/plugins/gitbook-plugin-livereload/plugin.js"></script>
    

<script>
require(["gitbook"], function(gitbook) {
    var config = {"expandable-chapters":{},"redirect":{},"splitter":{},"highlight":{},"search":{"maxIndexSize":1000000},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"livereload":{}};
    gitbook.start(config);
});
</script>

        
    </body>
    
</html>
